
import * as fs from "fs";
// import * as io from "socket.io-client"
import * as netio from "net"
//type Socket = netio.Socket;
type Socket = SocketIOClient.Socket;
let data:Buffer = fs.readFileSync("E:/TypeScript/jcre/javacard/framework/javacard/debug.msk");

let sock: Socket = io.connect("127.0.0.1:9550");

sock.on("connect",function(data){
    console.log("on connect");
    sock.send("Send my Message");
})

sock.on("message", function(message){
    console.log("on message");
})


// class BaseComm{
//     public sock: Socket;
//     public isconnected: boolean;
//     public constructor(){
//         this.sock = null;
//         this.isconnected = false;
//     }
    
//     public connect(ip:string, port:number){
//         this.sock = netio.connect(port, ip);
//         this.sock.on("connect", this.onconnect);
//         this.sock.on("data", this.ondata);
//         this.sock.on("close", this.onclose);
//         this.sock.on("error", this.onerror);
//         this.sock.on("end", this.onend);

       
//     }
//     public onconnect(){
//         this.isconnected = true;
//         console.log("on connect");
//         this.sock.write("from zhadaolong");
//     }
//     public ondata(){
//         console.log("on data");
        
//     }
//     public onclose(){
//         console.log("on close");

//     }
//     public onerror(){

//     }
//     public onend(){

//     }
// }


// let baseCmd = new BaseComm();

// baseCmd.connect("127.0.0.1", 9550);






